<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>部门测试</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
	
	<script type="text/javascript">
	
		function selectDept(deptName){
			var url="/dept/queryDeptBytname";
			var data={"dept.tname":deptName};
			$.post(url,data,function(data){
				if(data.deptList!=null){
					for ( var i = 0; i < data.deptList.length; i++) {
						//属性名必须大写
						alert(data.deptList[i].DEPTNAME);
					}
				}
			});
			
		}
	</script>
  </head>
  
  <body>
  	<table>
  		<tr>
  			<th>名字</th>
  		</tr>
  		<c:forEach items="${deptList }" var="dept">
  			<tr>
  				<td><a href="javascript:void(0);" onclick="selectDept('${dept.tname}');">${dept.tname }</a></td>
  			</tr>
  		</c:forEach>
  	</table>
  </body>
</html>
